package scene.mission
{
	import capricornus.components.event.SDispatcher;
	
	import event.GlobalEvent;
	
	import scene.Scene;
	import scene.event.SceneEvent;

	/**
	 * 关卡管理器
	 * @author kael
	 * 
	 */	
	public class MissionController
	{
		/**
		 * 场景 
		 */		
		private var _scene:Scene;
		/**
		 * 当前关卡 
		 */		
		private var _currentLevel:int = 1;
		
		public function MissionController( scene:Scene )
		{
			_scene = scene;
			init();
		}
		
		private function init():void
		{
			_scene.addEventListener( SceneEvent.DEMON_CLEAR, onDemonClear, false, 0, true );
			
			//监听关卡开始消息
			SDispatcher.addEventListenr( GlobalEvent.MISSION_START, onMissionStart );
		}
		
		public function destroy():void
		{
			_scene.removeEventListener( SceneEvent.DEMON_CLEAR, onDemonClear );
		}
		
		private function onMissionStart( e:GlobalEvent ):void
		{
			_currentLevel = int(e.data);
			//do 
		}
		
		private function onDemonClear( e:SceneEvent ):void
		{
			
		}
	}
}






